home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / ptv1n4.arc / PARK.PAS < prev    next >
Pascal/Delphi Source File  |  1990-09-13  |  1KB  |  38 lines

  1. {----------------------------------------------------------}
  2. { Park_Disk:  Safety routine to park  the hard disk heads  }
  3. { prior to executing critical code which could hang the    }
  4. { machine and force a re-boot.                             }
  5. {----------------------------------------------------------}
  6. PROCEDURE Park_Disk ;
  7.  
  8. CONST BIOS_Disk_Interrupt_No = $13;
  9. VAR Disk_Ordinal : WORD;
  10.  
  11. BEGIN {Park_Disk}
  12.   FOR Disk_Ordinal := $0080 TO $0083 DO BEGIN
  13.     Regs.AH := 8; {Return drive parameters}
  14.     Regs.DX := Disk_Ordinal;
  15.     Intr( BIOS_Disk_Interrupt_No, Regs );
  16.  
  17. {----------------------------------------------------------}
  18. { If Carry set, early version of BIOS which cannot execute }
  19. { Get Drive Parameters.                                    }
  20. {----------------------------------------------------------}
  21.  
  22.     IF ( Regs.Flags AND FCarry ) = 0 THEN BEGIN
  23. {----------------------------------------------------------}
  24. {  Bump "last usable cylinder" by one to get it off last   }
  25. {  cylinder.  Note:  This value is discontiguous in CX,    }
  26. {  hence the peculiar code.                                }
  27. {----------------------------------------------------------}
  28.       INC( Regs.CH );
  29.       IF Regs.CH = 0 THEN
  30.         INC( Regs.CL, $40 );
  31.       Regs.DX := Disk_Ordinal;
  32.       Regs.AX := $0c01;  {Seek to cylinder}
  33.       Intr( BIOS_Disk_Interrupt_No, Regs );
  34.     END;
  35.   END;
  36. END {Park_Disk};
  37.  
  38.